from typing import List

from src.bean.key_func import KeyFunc
from src.model.common.delete_model import delete_model_entrance
from src.model.common.importance import importance_to_file_entrance
from src.model.model_common_util import print_model_list_entrance, print_vector_entrance, print_vector_entrance_detail
from src.model.v1.v1_predict import v1_predict_file_entrance, v1_predict_realtime_entrance
from src.model.v1.v1_train import v1_first_train_entrance
from src.model.v2.predict_realtime import v2_predict_realtime_entrance
from src.model.v2.v2_predict import v2_predict_file_entrance
from src.model.v2.v2_train import v2_first_train_entrance
from src.util.common_util import loop_exe
from src.util.config_manager import ConfigManager


def model_operation_entrance(config: ConfigManager) -> None:
    op_map: List[KeyFunc] = [
        KeyFunc(key='[方案1]列出模型', func=print_model_list_entrance),
        KeyFunc(key='[方案1]文件预测', func=v1_predict_file_entrance),
        KeyFunc(key='[方案1]实时预测', func=v1_predict_realtime_entrance),
        KeyFunc(key='[方案1]首次训练', func=v1_first_train_entrance),
        KeyFunc(key='[方案1]输出相关度', func=importance_to_file_entrance),
        KeyFunc(key='[方案1]删除模型', func=delete_model_entrance),
        KeyFunc(key='[方案2]首次训练', func=v2_first_train_entrance),
        KeyFunc(key='[方案2]文件预测', func=v2_predict_file_entrance),
        KeyFunc(key='[方案2]实时预测', func=v2_predict_realtime_entrance),
        KeyFunc(key='[查看向量]数量', func=print_vector_entrance),
        KeyFunc(key='[查看向量]详情', func=print_vector_entrance_detail),
        KeyFunc(key='[返回]', func=None)
    ]
    loop_exe(op_map, config)
